package com.example.template.commontable.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.example.template.commontable.mapper.DictionaryMapper;
import com.example.template.core.annotation.MapperClass;
import com.example.template.core.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.*;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 
 * 统一字典
 * @author meko
 * @date 2019-12-02
 */
@Data
@Accessors(chain = true)
@ApiModel("统一字典")
@MapperClass(DictionaryMapper.class)
@Table(name = "`dictionary`")
public class Dictionary extends BaseEntity {
    /**
     * ID
     */
    @Id
    @Column(name = "`id`")
    @GeneratedValue(generator = "JDBC")
    @ApiModelProperty("ID")
    @Excel(name = "ID")
    private Integer id;

    /**
     * 值
     */
    @Column(name = "`value`")
    @ApiModelProperty("值")
    @Excel(name = "值")
    private String value;

    /**
     * 父ID
     */
    @Column(name = "`p_id`")
    @ApiModelProperty("父ID")
    @Excel(name = "父ID")
    private Integer pId;

    public static final String ID = "id";

    public static final String DB_ID = "id";

    public static final String VALUE = "value";

    public static final String DB_VALUE = "value";

    public static final String P_ID = "pId";

    public static final String DB_P_ID = "p_id";

    public static Dictionary defaultInstance() {
        Dictionary instance = new Dictionary();
        instance.pId = new Integer("0");
        return instance;
    }
}